import { defineStore } from "pinia";
import { ref } from "vue";

export const useUserStore = defineStore("user", () => {
    const token = ref("");
    const userId = ref("user-123");

    const checkToken = () => {
        const localToken = localStorage.getItem("token");
        if (localToken) {
            token.value = localToken;
        } else {
            token.value = "";
        }

        if (token.value) {
            return true;
        } else {
            return false;
        }
    };

    return {
        token,
        checkToken,
        userId,
    };
});
